package com.example.xmlparse;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;

import java.io.File;
import java.util.List;

public class MyXMLReader2JDOM {
    public static void main(String arge[]) {
        long lasting = System.currentTimeMillis();
        try {
            SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build(new File("C:\\Users\\86150\\IdeaProjects\\my-demo\\src\\main\\java\\com\\example\\xmlparse\\data_10k.xml"));
            Element foo = doc.getRootElement();
            List allChildren = foo.getChildren();
            for (Object allChild : allChildren) {
                System.out.print("车牌号码:" + ((Element) allChild).getChild("NO").getText());
                System.out.println("车主地址:" + ((Element) allChild).getChild("ADDR").getText());
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}